*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		FIGURES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"
		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/

*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** FIGURE A4
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	

use data/processed/data_1, clear 
keep if control_pure ==1

foreach x in expec_morehrs expec_retirlater expec_debthigher {
	replace `x' = `x'*100
}
* Expected changes in spending and debt by group	
		
	* spending change by netwealth
	graph bar (mean)  del_spend20_perc_tr02  , ///
			over(netwealth_Jan20_grp, relabel(1 1 2 2 3 3 4 4 5 5)) b1title() ///
			bargap(0)  /// 
			ytitle("Expected spending growth (%)", size(medsmall)) ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(-10(2)0, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp1.gph, replace)		
		
	* spending change  by age
	graph bar (mean)  del_spend20_perc_tr02  , ///
			over(agecat, relabel(1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65+") label(labsize(small))) b1title() ///
			bargap(0)  /// 
			ytitle("", size(medsmall)) ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(-10(2)0, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp2.gph, replace)		
		
	* spending change by netincome
	graph bar (mean)  del_spend20_perc_tr02  , ///
			over(hhnetinc_2019_grp) b1title() ///
			bargap(0)  /// 
			ytitle("", size(medsmall)) ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(-10(2)0, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp3.gph, replace)		
	
	* expected higher debt  by netwealth
	graph bar (mean)  expec_debthigher  , ///
			over(netwealth_Jan20_grp, relabel(1 1 2 2 3 3 4 4 5 5)) b1title(Net wealth quintile, size(medsmall)) ///
			bargap(0) exclude0  /// 
			ytitle("Increase expected debt (%)", size(medsmall)) ///
			graphregion(color(white)) bgcolor(white) ///
			ylabel(0(10)50, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp4.gph, replace)		

	* expected higher debt  by age
	graph bar (mean)  expec_debthigher  , ///
			over(agecat, relabel(1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65+") label(labsize(small))) b1title(Age group, size(medsmall)) ///
			bargap(0) exclude0  /// 
			ytitle("", size(medsmall)) ///
			graphregion(color(white)) bgcolor(white) ///
			ylabel(0(10)50, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp5.gph, replace)		
		
	* expected higher debt  by netincome
	graph bar (mean)  expec_debthigher  , ///
			over(hhnetinc_2019_grp) b1title(Net income quintile, size(medsmall)) ///
			bargap(0) exclude0  /// 
			ytitle("", size(medsmall)) ///
			graphregion(color(white)) bgcolor(white) ///
			ylabel(0(10)50, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp6.gph, replace)		
			
		graph combine Figures/temp1.gph ///
				  Figures/temp3.gph ///
				  Figures/temp2.gph ///
				  Figures/temp4.gph ///
				  Figures/temp6.gph ///
				  Figures/temp5.gph,  ysize(2) xsize(3) rows(2)  
	
	graph export Figures/FigureA4.pdf, as(pdf) fontface("cmr10") replace
	graph export Figures/FigureA4.png, width(1600) replace	
	
	
forvalues x = 1/6 {
		capture erase Figures/temp`x'.gph
}